@extends('adminDialog')

@section('content')
<div class="pop_cont pop_table" style="height:550px;">

    <div class="search_type cc mb10">
        <form action="{{url('admin/agents/sub',['id'=>$model->id])}}" method="get" class="search_form">
            <label for="search_name">姓名：</label><input type="text" name="name" value="{{$name}}" id="search_name" class="input length_2 mr10"/>
            <button type="submit" class="btn mr10">提交查询</button>
            <a href="{{url('admin/agents/subupdate',['id'=> 0,'parent_id'=>$model->id])}}" title="新增子账号" class="btn J_dialog"><span class="add"></span>[新增子账号]</a>
        </form>


    </div>

    <div class="table_list">
        <div id="data_list">
            <table class="items">
                <thead>
                <tr>
                    <th>账号</th>
                    <th>所在地</th>
                    <th>姓名</th>
                    <th>收入</th>
                    <th>金币</th>
                    <th>状态</th>
                    <th>注册时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach ($list as $item)
                    <tr>
                        <td>{{$item->name}}</td>
                        <td>
                            @if ($item->agents->province){{$item->agents->province->name}}省 @endif
                            @if ($item->agents->city) - {{$item->agents->city->name}}省 @endif
                            @if ($item->agents->area) - {{$item->agents->area->name}} @endif
                        </td>
                        <td>{{$item->real_name}}</td>
                        <td><a title="{{$item->nick}}的账户记录" href="{{url('admin/users/accountlog/'.$item->id.'/cash')}}" class="J_dialog">{{$item->account->cash}}</a></td>
                        <td><a title="{{$item->nick}}的账户记录" href="{{url('admin/users/accountlog/'.$item->id.'/coin')}}" class="J_dialog">{{$item->account->coin}}</a></td>
                        <td>@if ($item->status) <span class="green">启用</span> @else <span class="red">禁用</span> @endif</td>
                        <td>{{$item->created_at}}</td>
                        <td>
                            <a href="{{url('admin/agents/subupdate',['id'=>$item->id,'parent_id'=>$item->parent_id])}}" title="{{$item->name}}的资料" class="mr10 J_dialog">[编辑]</a>
                        </td>
                    </tr>
                @endforeach
                </tbody>
            </table>
        </div>

        <div class="summary">
            共有 {{$list->total()}} 条数据
        </div>
        @if ($list->hasPages())
            <div class="pager">
                <!--
                <span style="float:left; margin-right:10px;">
                    转至<input type="text" id="goToPage" class="input" style="width:30px; text-align:center;">页
                    <span onclick="goto();" class="btn btn_submit">跳转</span>
                </span>
                -->
                {!! $list->appends($appends)->render() !!}
            </div>
        @endif
    </div>
</div>
@stop

@section('style')
    <style>
        .body_none {width:800px;}
    </style>
@stop